name = 'qwsafasfasfase'

print('q' in name)
print('as' in name)
print('as' not in name)

# 从左往右 0开始
print("从左往右 0开始:", name[0])
# 从右往左 -1 开始
print("从右往左 -1 开始:", name[-1])

# 字符串截取 ,包前不包后  ,最后是步长 正数从左往右切,负数从右往左 ,每隔几个输出
print(name[0:2])
print(name[1:])
print(name[:2])

print("从右往左截取")
print(name[-1:-2:-1])

# 查找字符串
# 查找字符串
# 查找字符串

print("字符串查找:", name.find('q', 0))
print("获取字符串的下标:", name.index("q"))
print("字符串出现的次数:", name.count("q"))
